//functions.cpp

// compile with: /EHsc /LD
//EHsc catches exceptions, LD specifies the output as DLL

#include "functions.h"
#include <stdexcept>

using namespace std;

namespace functions
{
    double calc::Add(double a, double b)
    {
        return a + b;
    }

    double calc::Subtract(double a, double b)
    {
        return a - b;
    }

    double calc::Multiply(double a, double b)
    {
        return a * b;
    }

    double calc::Divide(double a, double b)
    {
        if (b == 0)
        {
            throw new invalid_argument("b cannot be zero!");
        }

        return a / b;
    }
}